<div ng-init="dvm.init()">
  <form name="clothingForm" class="form-check" ng-submit="dvm.save(clothingForm.$valid)" novalidate>
    <div class="ngdialog-message">
      <h3>编辑物品</h3>
      <input type="hidden" ng-model="dvm.property.id">
      <div class="form-group">
        <input name="clothingName" ng-model="dvm.property.name" class="form-control" placeholder="物品名称" autofocus required>
        <p class="alert alert-danger" ng-show="clothingForm.$submitted && clothingForm.clothingName.$error.required">
          <i class="glyphicon glyphicon-info-sign"></i> 物品名称不能为空</p>
      </div>
      <div class="form-group">
        <select name="categoryId" ng-model="dvm.property.categoryId" class="form-control" required
            ng-options="x.id as x.name group by x.parentName for x in dvm.category">
          <option value="">- 物品分类 -</option>
        </select>
        <p class="alert alert-danger" ng-show="clothingForm.$submitted && clothingForm.categoryId.$error.required">
          <i class="glyphicon glyphicon-info-sign"></i> 物品分类不能为空</p>
      </div>
      <div class="form-group">
        <input type="number" name="price" ng-model="dvm.property.price" min="0" class="form-control" placeholder="价格" required>
        <p class="alert alert-danger" ng-show="clothingForm.$submitted && clothingForm.price.$error.required">
          <i class="glyphicon glyphicon-info-sign"></i> 价格不能为空</p>
        <p class="alert alert-danger" ng-show="clothingForm.$submitted && clothingForm.price.$error.number">
          <i class="glyphicon glyphicon-info-sign"></i> 价格不是有效的数字</p>
        <p class="alert alert-danger" ng-show="clothingForm.$submitted && clothingForm.price.$error.min">
          <i class="glyphicon glyphicon-info-sign"></i> 价格不能是小于0的数字</p>
      </div>
      <div class="form-group">
        <div class="input-group date" ng-datepicker="" ng-datepicker-options="{endDate:'new Date()'}">
          <input type="text" name="buyDate" class="form-control" ng-model="dvm.property.buyDate" placeholder="购买日期" readonly required>
          <div class="input-group-addon">
            <span class="glyphicon glyphicon-th"></span>
          </div>
        </div>
        <p class="alert alert-danger" ng-show="clothingForm.$submitted && clothingForm.buyDate.$error.required">
          <i class="glyphicon glyphicon-info-sign"></i> 购买日期不能为空</p>
      </div>
      <div class="form-group">
        <textarea rows="3" class="form-control" ng-model="dvm.property.description" placeholder="物品描述（200字以内）" maxlength="200"></textarea>
      </div>
    </div>
    <div class="ngdialog-buttons">
      <button type="button" class="ngdialog-button ngdialog-button-secondary" ng-click="closeThisDialog()">取 消</button>
      <button type="submit" class="ngdialog-button ngdialog-button-primary">保 存</button>
      <button type="button" class="ngdialog-button ngdialog-button-success" ng-click="dvm.upload()">上传图片</button>
    </div>
  </form>
</div>